package com.ai.web.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ai.web.service.CommentRepairService;
import com.ai.web.vo.CommentRepairV;
import com.ai.web.vo.ResultModel;
import com.tiny.persistence.domain.CommentRepair;
import com.tiny.persistence.repository.CommentRepairRepo;

@Service("commentRepairService")
public class CommentRepairServiceImpl extends BaseServiceImpl<CommentRepair, Integer, CommentRepairV> implements CommentRepairService  {

    @Autowired
    private CommentRepairRepo commentRepairRepo;
    
    @Autowired
    public CommentRepairServiceImpl(CommentRepairRepo commentRepairRepo) {
        super(commentRepairRepo);
    }

    public CommentRepairV getCommentRepair(int repairId) throws Exception {
        return getT(repairId);
    }

    public ResultModel saveCommentRepair(CommentRepairV commentRepairV) throws Exception {
        
        CommentRepairV saveV = saveT(commentRepairV);
        
        ResultModel rm = new ResultModel();
        rm.setData(saveV);
        rm.setSuccessCode();
        
        return rm;
    }

    public ResultModel deleteCommentRepairs(List<Integer> userIds) throws Exception {
        deleteTs(userIds);
        
        ResultModel rm = new ResultModel();
        rm.setSuccessCode();
        rm.setMsg("删除成功！");
        
        return rm;
    }
    
    //维护评价
    public ResultModel maintenanceEvaluation(CommentRepairV commentRepairV) throws Exception {
        
        CommentRepairV saveV = saveT(commentRepairV);
        
        ResultModel rm = new ResultModel();
        rm.setData(saveV);
        rm.setSuccessCode();
        
        return rm;
    }

	public CommentRepair getByRepairId(int repairId) throws Exception {
		return commentRepairRepo.getByRepairId(repairId);
	}

}
